/**
 * 渠道区分
 * @param {*} userid // 外部来源id判断是否邀请
 */
function channelDifferentiation(options) {
	console.log(options, "options");
	if (!options) {
		return;
	}
	let userid = "";
	let gdt_vid = "";
	let adType = "";
	// url参数中可以获取到gdt_vid、adId参数值
	if (!!options.gdt_vid) {
		gdt_vid = options.gdt_vid;
		wx.setStorageSync("gdt_vid", gdt_vid);
	}
	if (!!options.adId) {
		adType = options.adId;
		wx.setStorageSync("adType", adType);
	}
	if (!!options.userid) {
		userid = options.userid;
	}
	if (!!options.scene) {
		userid = options.scene;
	}
	if (userid) {
		wx.setStorageSync("inviterId", userid);
	}

	let baseinfo = wx.getStorageSync("baseinfo");
	// 广告进入 区分
	// if (!!gdt_vid) {
	// 	switch (adType) {
	// 		case "plaque":
	// 			baseinfo.df = "plaqueAD";
	// 			break;
	// 		case "incentive":
	// 			baseinfo.df = "incentiveAD";
	// 			break;
	// 		case "banner":
	// 			baseinfo.df = "bannerAD";
	// 			break;
	// 		default:
	// 			break;
	// 	}
	// 	wx.setStorageSync("baseinfo", baseinfo);
	// }
	// 用户分享 区分
	let userDistinction = wx.getStorageSync("userDistinction");
	if (!!userDistinction) {
		userDistinction.execute = true;
		baseinfo.df = "smallapp" + userDistinction.type;
		wx.setStorageSync("userDistinction", userDistinction);
		wx.setStorageSync("baseinfo", baseinfo);
	}
	// 邀请进入 区分
	if (!!userid) {
		let userDistinction = {
			type: "YQ",
			execute: true,
		};
		baseinfo.df = "smallapp" + userDistinction.type;
		wx.setStorageSync("userDistinction", userDistinction);
		wx.setStorageSync("baseinfo", baseinfo);
	}
}

export {
	channelDifferentiation
};